java get element occurrences in a list java

54

how to count the number of occurrences of an element in a arraylist in java -

int occurrences = Collections.frequency(animals, "bat");

Comments

Submit
0 Comments